import random


num = random.randint(1, 100)
print(num)

count=0
while count<5:
    count+=1
    num_guess = int(input("请输入随机数:"))
    if num_guess>num:
        print("大了")
    elif num_guess<num:
        print("小了")
    else:
        print("猜了"+str(count)+"次猜对了!")
        break
else:
    print("游戏失败!")